<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<style>
		li{display:inline-block;margin:25px}
	</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>会员列表</title>
 <link rel="stylesheet" href="{{ asset('admin_style/css/pintuer.css') }}">
   <link rel="stylesheet" href="{{ asset('admin_style/css/admin.css') }}">
    <script src="{{asset('admin_style/js/jquery.js')}}"></script>
    <script src="{{asset('admin_style/js/pintuer.js')}}"></script>
    <script src="{{asset('admin_style/js/layer/layer.js')}}"></script>
</head>
<body>
<div id="box">
<a href="JavaScript:;" id="administrator_add" class="button bg-yellow button-small"><span class="icon-plus"></span>添加会员</a>
<form method="post" action="" id="listform">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 会员列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li>会员名称</li>
        <li>
          <input type="text" placeholder="输入关键字" id="key" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="key()" > 搜索</a></li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>
        <th width="10%">用户名</th>
        <th>性别</th>
        <th>手机</th>
        <th>头像</th>
        <th>本次登陆时间</th>
        <th width="10%">注册时间</th>
        <th width="310">操作</th>
      </tr>
      <volist name="list" id="vo">
        @foreach($users as $k => $v)
        <tr>
          <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="check" value="{{$v->uid}}" />{{$v->uid}}</td>
          <td>{{$v->u_name}}</td>
          <td>{{$v->u_sex}}</td>
          <td>{{$v->u_phone}}</td>
          <td><img src="{{asset('admin_style/uploads')}}/{{$v->u_portrait}}" width="60px"></td>
          <td>{{$v->u_login_time}}</td>
          <td>{{$v->u_reg_time}}</td>
          <td><div class="button-group"> <a class="button border-main" href="{{url('/user/edit')}}/{{$v->uid}}"><span class="icon-edit"></span> 修改</a> <a class="button border-red" href="javascript:void(0)" onclick="return del({{$v->uid}})"><span class="icon-trash-o"></span> 删除</a> </div></td>
        </tr>
        @endforeach
      <tr>
        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checked" onclick="checkAll()"/>
          全选 </td>
        <td colspan="8" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="dels()"> 批量删除</a>
      </tr>
      </volist>
    </table>
      <div class='fenye'><center>{{$users->links()}}</center></div>
  </div>
</form>
</div>
<div id="add_administrator_style" class="add_menber" style="display:none">
    <form method="post" class="form-x" action="{{url('/user/add_do')}}" enctype="multipart/form-data">
        {{ csrf_field() }}
        <div class="form-group">
            <div class="label">
                <label>会员名称：</label>
            </div>
            <div class="field">
                <input type="text" class="input" name="u_name" value="{{ old('u_name') }}" />
                @if($errors->has('u_name'))
                    <span class="col">{{$errors->first('u_name')}}</span>
                @endif
                <div class="tips"></div>
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label>登录密码：</label>
            </div>
            <div class="field">
                <input type="text" name='password' class="input" value="{{ old('password') }}"/>
                @if($errors->has('password'))
                    <span class="col">{{$errors->first('password')}}</span>
                @endif
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label>确认密码：</label>
            </div>
            <div class="field">
                <input type="text" name='password_confirmation' class="input" value="{{ old('password_confirmation') }}"/>
                @if($errors->has('password_confirmation'))
                    <span class="col">{{$errors->first('password_confirmation')}}</span>
                @endif
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label>性别：</label>
            </div>
            <div class="field">
                <div class="product-mulde product-mulde-a">
                    <ul>
                        <li>
                            <input type="radio" name="u_sex" value="男">男
                            <input type="radio" name="u_sex" value="女">女
                        </li>
                    </ul>
                    @if($errors->has('u_sex'))
                        <span class="col">{{$errors->first('u_sex')}}</span>
                    @endif
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label>所在省：</label>
            </div>
            <div class="field">
                <input type="text" name='u_r_province' class="input" value="{{ old('u_r_province') }}"/>
                @if($errors->has('u_r_province'))
                    <span class="col">{{$errors->first('u_r_province')}}</span>
                @endif
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label>所在市：</label>
            </div>
            <div class="field">
                <input type="text"  name='u_r_city' class="input" value="{{ old('u_r_city') }}"/>
                @if($errors->has('u_r_city'))
                    <span class="col">{{$errors->first('u_r_city')}}</span>
                @endif
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label>手机：</label>
            </div>
            <div class="field">
                <input type="text" name="u_phone" class="input" value="{{ old('u_phone') }}"/>
                @if($errors->has('u_phone'))
                    <span class="col">{{$errors->first('u_phone')}}</span>
                @endif
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label>描述：</label>
            </div>
            <div class="field">
                <input type="text" name="u_desc" class="input" value="{{ old('u_desc') }}"/>
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label>头像：</label>
            </div>
            <div class="field">
                <input type="file" name="slogo" id="1" style="display: none" />
                <input type="button" class="button bg-blue margin-left" id="image1" value="+ 浏览上传" onclick="document.getElementById(1).click();">
            </div>
        </div>
        <div class="form-group">
            <div class="text-center">
                <div class="field">
                    <input class="button bg-green" type="submit" value="确定">
                    <input type="reset" class="button bg-red" value="重置" />
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    /*添加会员*/
    $('#administrator_add').on('click', function(){
        layer.open({
            type: 1,
            title:'添加会员',
            area: ['700px',''],
            shadeClose: false,
            content: $('#add_administrator_style'),

        });
    })
//搜索
function key(){
	var key     = document.getElementById("key");
	var xh      = new XMLHttpRequest();
	xh.open('get',"{{url('user/hy_list/')}}/"+key.value,true);
	xh.send();
	xh.onreadystatechange = function(){
		if(xh.readyState == 4 && xh.status==200){
			document.getElementById('box').innerHTML=xh.responseText;
		}
	}
}
//单个删除
function del(id){
	if(confirm("您确定要删除吗?")){
		location.href="{{url('/user/del')}}/"+id
	}
}
//全选
function checkAll(){
	var par = document.getElementsByName('checked');
	var str = document.getElementsByName('check');
	for(var i=0;i<str.length;i++){
		str[i].checked = !str[i].checked;
	}
	par.checked = str.checked;
}
//批量删除
function dels(){
	var check = document.getElementsByName('check');
	var ids=[];
	for(var i=0;i<check.length;i++){
		if(check[i].checked){
			ids.push(check[i].value);
		}
	}
	var str = ids.join(',');
    location.href="{{url('/user/dels/')}}/"+str;
}
</script>
</body>
</html>
